<template>
	<view class="container bg" :style="'min-height:'+ cheight+'px;'">
		<view class="cellbox">
			<u-cell-group :border="false">
				<u-cell-item :border-bottom="false" @click="goUser" bg-color="#19191b" style='border-bottom: 1px solid #2d2d2d;' icon="account-fill" title="个人信息"></u-cell-item>
				<u-cell-item :border-bottom="false" @click="toAuth" bg-color="#19191b" icon="account-fill" title="身份认证" :value="is_auth"></u-cell-item>
			</u-cell-group>
			<view class="box2">
				<u-cell-group :border="false">
					<u-cell-item bg-color="#19191b" @click="goForget" :border-bottom="false" style='border-bottom: 1px solid #2d2d2d;' icon="lock" title="登录密码"></u-cell-item>
					<u-cell-item bg-color="#19191b" @click="toRetrieve" :border-bottom="false" icon="lock" title="寄售密码"></u-cell-item>
				</u-cell-group>
			</view>
			<view class="box2">
				<u-cell-group :border="false">
					<u-cell-item bg-color="#19191b" :border-bottom="false" @click="toInvite" style='border-bottom: 1px solid #2d2d2d;' icon="zhuanfa" title="邀请好友
					"></u-cell-item>
					<u-cell-item bg-color="#19191b" @click="toTeam" :border-bottom="false" icon="account" title="我的团队"></u-cell-item>
				</u-cell-group>
			</view>
			<view class="box2">
				<u-cell-group :border="false">
					<u-cell-item bg-color="#19191b" :border-bottom="false" @click="toStuff" style='border-bottom: 1px solid #2d2d2d;' icon="integral" title="我的材料
					"></u-cell-item>
					<u-cell-item bg-color="#19191b" @click="transferRecord" :border-bottom="false" icon="gift" title="转赠记录"></u-cell-item>
					<u-cell-item bg-color="#19191b" @click="toChip" :border-bottom="false" icon="grid" title="我的合成"></u-cell-item>
				</u-cell-group>
			</view>
		</view>
		<view class="btnbox" @click="quit">退出登录</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cheight:'',
				userInfo: {
				  headImg: ''
				},
				is_auth:'',
			}
		},
		onLoad: function () {
		   this.cheight=wx.getSystemInfoSync().windowHeight
		 },
		 onPullDownRefresh() {
		 	console.log('refresh');
		 	setTimeout(function () {
		 		uni.stopPullDownRefresh();
		 		
		 	}, 1000);
		 	this.$http('api/user/userInfo').then(res => {
		 	  this.userInfo = res;
		 		if(this.userInfo.is_auth==1){
		 			this.is_auth='已认证'
		 		}else{
		 			this.is_auth='未认证'
		 		}
		 	});
		 },
		onShow() {
		  this.$http('api/user/userInfo').then(res => {
		    this.userInfo = res;
				if(this.userInfo.is_auth==1){
					this.is_auth='已认证'
				}else{
					this.is_auth='未认证'
				}
		  });
		},
		methods: {
			goForget(){
				uni.navigateTo({
					// url:"./forgetPsd",
					url:'/pages/login/forgetPsd'
				})
			},
			transferRecord() {
			  uni.navigateTo({
			    url: './transferRecord'
			  });
			},
			toChip(){
				uni.switchTab({
				  // url: './transferRecord'
					url:'../chip/index'
				});
			},
			toStuff() {
			  uni.navigateTo({
			    url: '../chip/stuff'
			  });
			},
			toTeam() {
			  uni.navigateTo({
			    url: './myTeam'
			  });
			},
			toInvite() {
			  uni.navigateTo({
			    url: './myInvite'
			  });
			},
			toRetrieve(){
				uni.navigateTo({
					url:'./retrieve'
				})
			},
			toAuth() {
			  uni.navigateTo({
			    url: './realAuth'
			  });
			},
			goUser() {
			  uni.navigateTo({
			    url: './editUser'
			  });
			},
			quit() {
			  wx.showToast({
			  	title: '退出登录成功!',
			  	icon: 'success'
			  })
			  setTimeout(() => {
				uni.removeStorageSync('token');
			  	uni.navigateTo({
			  	  url: '../login/index'
			  	});
			  }, 1000);
			},
		}
	}
</script>

<style lang="less" scoped>
.container{
	width: 100%;
	height: 100vw;
	.cellbox{
		.box2{
			margin-top: 20rpx;
		}
	}
	.btnbox{
		position: fixed;
		bottom: 20rpx;
		width: 96%;
		height: 90rpx;
		line-height: 90rpx;
		margin: 0 2%;
		text-align: center;
		color: #fff;
		background-image: linear-gradient(to left top,#714aed,#3b37f3);
		border-radius: 40rpx;
	}
}
</style>
